package com.neouton.feginClient;

import com.neouton.common.util.ResponseAPI;
import com.neouton.crm.entity.FileUploadRecordVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@FeignClient(url = "${file.server}", name = "file")
public interface FileService {
    @PostMapping(value = "/fileHandle/upload2Ftp", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    ResponseAPI<FileUploadRecordVO> upload2Ftp(@RequestPart("file") MultipartFile file, @RequestHeader("token") String token);


    /**
     * 文件上传，包含制定路径
     * @param file
     * @param param
     * @param token
     * @return
     */
    @PostMapping(value = "/fileHandle/upload2Ftp", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    ResponseAPI<FileUploadRecordVO> upload2Ftp(@RequestPart("file") MultipartFile file,
                                               @RequestParam FileUploadRecordVO param,
                                               @RequestHeader("token") String token);

    /**
     * 批量上传，包含制定路径
     * @param files
     * @param param
     * @param token
     * @return
     */
    @PostMapping(value = "/fileHandle/upload2FtpBatch", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    ResponseAPI<List<FileUploadRecordVO>> upload2FtpBatch(@RequestPart("file") List<MultipartFile> files,
                                                          @RequestParam FileUploadRecordVO param,
                                                          @RequestHeader("token") String token);


}
